﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;
using System.Collections.ObjectModel;
using NicolasLight.ContactUsServiceReference;
using NicolasLight;

namespace NicolasLight.Pages
{
    public partial class Services : Page
    {

        public ObservableCollection<ContactUs> Contact { get; set; }

        private ContactUsServiceClient client;

        public Services()
        {

            InitializeComponent();

        }

        void client_SaveContactUsCompleted(object sender, SaveContactUsCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                if (e.Result)
                {
                    MessageBox.Show("Thank You For Contact Us.");
                }
                else
                {
                    MessageBox.Show("Please Try Again, An Error Has Occured.");
                }
            }
            else
            {
                MessageBox.Show(e.Error.Message);
            }
        }

        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
        }

        private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            ContactUsServiceClient client = new ContactUsServiceClient();
            client.SaveContactUsCompleted += new EventHandler<SaveContactUsCompletedEventArgs>(client_SaveContactUsCompleted);
            client.SaveContactUsAsync((ContactUsDTO));
        }
    }
}